home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg2.cab / ooo2wordml_text.xsl < prev    next >
Extensible Markup Language  |  2005-09-10  |  77KB  |  1,288 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.     OpenOffice.org - a multi-platform office productivity suite
  5.  
  6.     $RCSfile: ooo2wordml_text.xsl,v $
  7.  
  8.     $Revision: 1.8 $
  9.  
  10.     last change: $Author: rt $ $Date: 2005/09/08 22:07:59 $
  11.  
  12.     The Contents of this file are made available subject to
  13.     the terms of GNU Lesser General Public License Version 2.1.
  14.  
  15.  
  16.       GNU Lesser General Public License Version 2.1
  17.       =============================================
  18.       Copyright 2005 by Sun Microsystems, Inc.
  19.       901 San Antonio Road, Palo Alto, CA 94303, USA
  20.  
  21.       This library is free software; you can redistribute it and/or
  22.       modify it under the terms of the GNU Lesser General Public
  23.       License version 2.1, as published by the Free Software Foundation.
  24.  
  25.       This library is distributed in the hope that it will be useful,
  26.       but WITHOUT ANY WARRANTY; without even the implied warranty of
  27.       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  28.       Lesser General Public License for more details.
  29.  
  30.       You should have received a copy of the GNU Lesser General Public
  31.       License along with this library; if not, write to the Free Software
  32.       Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  33.       MA  02111-1307  USA
  34.  
  35. -->
  36. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg   dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
  37.     <xsl:template match="style:paragraph-properties" mode="paragraph">
  38.         <w:pPr>
  39.             <w:adjustRightInd w:val="off"/>
  40.             <xsl:if test="@fo:break-before = 'page'">
  41.                 <w:pageBreakBefore w:val="on"/>
  42.             </xsl:if>
  43.             <xsl:if test="contains(@style:writing-mode, 'rl')">
  44.                 <w:bidi/>
  45.             </xsl:if>
  46.             <xsl:choose>
  47.                 <xsl:when test="@fo:text-align-last = 'start'">
  48.                     <xsl:choose>
  49.                         <xsl:when test="contains(@style:writing-mode, 'rl')">
  50.                             <w:jc w:val="right"/>
  51.                         </xsl:when>
  52.                         <xsl:otherwise>
  53.                             <w:jc w:val="left"/>
  54.                         </xsl:otherwise>
  55.                     </xsl:choose>
  56.                 </xsl:when>
  57.                 <xsl:when test="@fo:text-align-last = 'justify'">
  58.                     <w:jc w:val="distribute"/>
  59.                 </xsl:when>
  60.                 <xsl:when test="@fo:text-align-last = 'center'">
  61.                     <w:jc w:val="center"/>
  62.                 </xsl:when>
  63.                 <xsl:when test="@fo:text-align = 'start'">
  64.                     <xsl:choose>
  65.                         <xsl:when test="contains(@style:writing-mode, 'rl')">
  66.                             <w:jc w:val="right"/>
  67.                         </xsl:when>
  68.                         <xsl:otherwise>
  69.                             <w:jc w:val="left"/>
  70.                         </xsl:otherwise>
  71.                     </xsl:choose>
  72.                 </xsl:when>
  73.                 <xsl:when test="@fo:text-align = 'end'">
  74.                     <xsl:choose>
  75.                         <xsl:when test="contains(@style:writing-mode, 'rl')">
  76.                             <w:jc w:val="left"/>
  77.                         </xsl:when>
  78.                         <xsl:otherwise>
  79.                             <w:jc w:val="right"/>
  80.                         </xsl:otherwise>
  81.                     </xsl:choose>
  82.                 </xsl:when>
  83.                 <xsl:when test="@fo:text-align = 'justify'">
  84.                     <w:jc w:val="distribute"/>
  85.                 </xsl:when>
  86.                 <xsl:when test="@fo:text-align = 'center'">
  87.                     <w:jc w:val="center"/>
  88.                 </xsl:when>
  89.             </xsl:choose>
  90.             <w:spacing>
  91.                 <xsl:choose>
  92.                     <xsl:when test="@fo:line-height">
  93.                         <xsl:choose>
  94.                             <xsl:when test="contains(@fo:line-height, '%')">
  95.                                 <xsl:attribute name="w:line-rule">auto</xsl:attribute>
  96.                                 <xsl:attribute name="w:line">
  97.                                     <xsl:value-of select="round(substring-before(@fo:line-height, '%') div 100 * 240)"/>
  98.                                 </xsl:attribute>
  99.                             </xsl:when>
  100.                             <xsl:otherwise>
  101.                                 <xsl:attribute name="w:line-rule">exact</xsl:attribute>
  102.                                 <xsl:attribute name="w:line">
  103.                                     <xsl:call-template name="convert2twip">
  104.                                         <xsl:with-param name="value" select="@fo:line-height"/>
  105.                                     </xsl:call-template>
  106.                                 </xsl:attribute>
  107.                             </xsl:otherwise>
  108.                         </xsl:choose>
  109.                     </xsl:when>
  110.                     <xsl:when test="@style:line-height-at-least">
  111.                         <xsl:attribute name="w:line-rule">at-least</xsl:attribute>
  112.                         <xsl:attribute name="w:line">
  113.                             <xsl:call-template name="convert2twip">
  114.                                 <xsl:with-param name="value" select="@style:line-height-at-least"/>
  115.                             </xsl:call-template>
  116.                         </xsl:attribute>
  117.                     </xsl:when>
  118.                     <xsl:when test="@style:line-spacing">
  119.                         <xsl:attribute name="w:line-rule">auto</xsl:attribute>
  120.                         <xsl:variable name="spacing">
  121.                             <xsl:call-template name="convert2twip">
  122.                                 <xsl:with-param name="value" select="@style:line-spacing"/>
  123.                             </xsl:call-template>
  124.                         </xsl:variable>
  125.                         <xsl:attribute name="w:line">
  126.                             <xsl:value-of select="round($spacing div 0.567)"/>
  127.                         </xsl:attribute>
  128.                     </xsl:when>
  129.                 </xsl:choose>
  130.                 <xsl:if test="@fo:margin-top">
  131.                     <xsl:choose>
  132.                         <xsl:when test="contains(@fo:margin-top, '%')">
  133.                             <xsl:if test="../@style:parent-style-name">
  134.                                 <xsl:variable name="parent-size">
  135.                                     <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-top"/>
  136.                                 </xsl:variable>
  137.                                 <xsl:variable name="w-number">
  138.                                     <xsl:call-template name="convert2twip">
  139.                                         <xsl:with-param name="value" select="$parent-size"/>
  140.                                     </xsl:call-template>
  141.                                 </xsl:variable>
  142.                                 <xsl:attribute name="w:before">
  143.                                     <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-top, '%'))"/>
  144.                                 </xsl:attribute>
  145.                             </xsl:if>
  146.                         </xsl:when>
  147.                         <xsl:otherwise>
  148.                             <xsl:attribute name="w:before">
  149.                                 <xsl:call-template name="convert2twip">
  150.                                     <xsl:with-param name="value" select="@fo:margin-top"/>
  151.                                 </xsl:call-template>
  152.                             </xsl:attribute>
  153.                         </xsl:otherwise>
  154.                     </xsl:choose>
  155.                 </xsl:if>
  156.                 <xsl:if test="@fo:margin-bottom">
  157.                     <xsl:choose>
  158.                         <xsl:when test="contains(@fo:margin-bottom, '%')">
  159.                             <xsl:if test="../@style:parent-style-name">
  160.                                 <xsl:variable name="parent-size">
  161.                                     <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-bottom"/>
  162.                                 </xsl:variable>
  163.                                 <xsl:variable name="w-number">
  164.                                     <xsl:call-template name="convert2twip">
  165.                                         <xsl:with-param name="value" select="$parent-size"/>
  166.                                     </xsl:call-template>
  167.                                 </xsl:variable>
  168.                                 <xsl:attribute name="w:after">
  169.                                     <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-bottom, '%'))"/>
  170.                                 </xsl:attribute>
  171.                             </xsl:if>
  172.                         </xsl:when>
  173.                         <xsl:otherwise>
  174.                             <xsl:attribute name="w:after">
  175.                                 <xsl:call-template name="convert2twip">
  176.                                     <xsl:with-param name="value" select="@fo:margin-bottom"/>
  177.                                 </xsl:call-template>
  178.                             </xsl:attribute>
  179.                         </xsl:otherwise>
  180.                     </xsl:choose>
  181.                 </xsl:if>
  182.             </w:spacing>
  183.             <w:ind>
  184.                 <xsl:if test="@fo:margin-left">
  185.                     <xsl:choose>
  186.                         <xsl:when test="contains(@fo:margin-left, '%')">
  187.                             <xsl:if test="../@style:parent-style-name">
  188.                                 <xsl:variable name="parent-size">
  189.                                     <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-left"/>
  190.                                 </xsl:variable>
  191.                                 <xsl:variable name="w-number">
  192.                                     <xsl:call-template name="convert2twip">
  193.                                         <xsl:with-param name="value" select="$parent-size"/>
  194.                                     </xsl:call-template>
  195.                                 </xsl:variable>
  196.                                 <xsl:attribute name="w:left">
  197.                                     <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-left, '%'))"/>
  198.                                 </xsl:attribute>
  199.                             </xsl:if>
  200.                         </xsl:when>
  201.                         <xsl:otherwise>
  202.                             <xsl:attribute name="w:left">
  203.                                 <xsl:call-template name="convert2twip">
  204.                                     <xsl:with-param name="value" select="@fo:margin-left"/>
  205.                                 </xsl:call-template>
  206.                             </xsl:attribute>
  207.                         </xsl:otherwise>
  208.                     </xsl:choose>
  209.                 </xsl:if>
  210.                 <xsl:if test="@fo:margin-right">
  211.                     <xsl:choose>
  212.                         <xsl:when test="contains(@fo:margin-right, '%')">
  213.                             <xsl:if test="../@style:parent-style-name">
  214.                                 <xsl:variable name="parent-size">
  215.                                     <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-right"/>
  216.                                 </xsl:variable>
  217.                                 <xsl:variable name="w-number">
  218.                                     <xsl:call-template name="convert2twip">
  219.                                         <xsl:with-param name="value" select="$parent-size"/>
  220.                                     </xsl:call-template>
  221.                                 </xsl:variable>
  222.                                 <xsl:attribute name="w:right">
  223.                                     <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-right, '%'))"/>
  224.                                 </xsl:attribute>
  225.                             </xsl:if>
  226.                         </xsl:when>
  227.                         <xsl:otherwise>
  228.                             <xsl:attribute name="w:right">
  229.                                 <xsl:call-template name="convert2twip">
  230.                                     <xsl:with-param name="value" select="@fo:margin-right"/>
  231.                                 </xsl:call-template>
  232.                             </xsl:attribute>
  233.                         </xsl:otherwise>
  234.                     </xsl:choose>
  235.                 </xsl:if>
  236.                 <xsl:if test="@fo:text-indent">
  237.                     <xsl:choose>
  238.                         <!-- When @style:auto-text-indent='true' @fo:text-indent ignored, use 283 for all font size -->
  239.                         <xsl:when test="@style:auto-text-indent='true'">
  240.                             <xsl:attribute name="w:first-line">283</xsl:attribute>
  241.                         </xsl:when>
  242.                         <xsl:when test="contains(@fo:text-indent, '%')">
  243.                             <xsl:if test="../@style:parent-style-name">
  244.                                 <xsl:variable name="parent-size">
  245.                                     <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:text-indent"/>
  246.                                 </xsl:variable>
  247.                                 <xsl:variable name="w-number">
  248.                                     <xsl:call-template name="convert2twip">
  249.                                         <xsl:with-param name="value" select="$parent-size"/>
  250.                                     </xsl:call-template>
  251.                                 </xsl:variable>
  252.                                 <xsl:choose>
  253.                                     <xsl:when test="$w-number < 0">
  254.                                         <xsl:attribute name="w:hanging">
  255.                                             <xsl:value-of select="round($w-number div -100 * substring-before(@fo:text-indent, '%'))"/>
  256.                                         </xsl:attribute>
  257.                                     </xsl:when>
  258.                                     <xsl:otherwise>
  259.                                         <xsl:attribute name="w:first-line">
  260.                                             <xsl:value-of select="round($w-number div 100 * substring-before(@fo:text-indent, '%'))"/>
  261.                                         </xsl:attribute>
  262.                                     </xsl:otherwise>
  263.                                 </xsl:choose>
  264.                             </xsl:if>
  265.                         </xsl:when>
  266.                         <xsl:when test="starts-with(@fo:text-indent,'-')">
  267.                             <xsl:attribute name="w:hanging">
  268.                                 <xsl:call-template name="convert2twip">
  269.                                     <xsl:with-param name="value" select="substring-after(@fo:text-indent,'-')"/>
  270.                                 </xsl:call-template>
  271.                             </xsl:attribute>
  272.                         </xsl:when>
  273.                         <xsl:otherwise>
  274.                             <xsl:attribute name="w:first-line">
  275.                                 <xsl:call-template name="convert2twip">
  276.                                     <xsl:with-param name="value" select="@fo:text-indent"/>
  277.                                 </xsl:call-template>
  278.                             </xsl:attribute>
  279.                         </xsl:otherwise>
  280.                     </xsl:choose>
  281.                 </xsl:if>
  282.             </w:ind>
  283.             <xsl:if test="contains(@fo:background-color, '#')">
  284.                 <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/>
  285.             </xsl:if>
  286.             <xsl:if test="@fo:keep-with-next='true'">
  287.                 <w:keepNext/>
  288.             </xsl:if>
  289.             <xsl:choose>
  290.                 <xsl:when test="@fo:widows | @fo:orphans">
  291.                     <w:widowControl w:val="on"/>
  292.                 </xsl:when>
  293.                 <xsl:otherwise>
  294.                     <w:widowControl w:val="off"/>
  295.                 </xsl:otherwise>
  296.             </xsl:choose>
  297.             <xsl:if test="@style:break-inside = 'avoid'">
  298.                 <w:keepLines/>
  299.             </xsl:if>
  300.             <xsl:if test="@fo:hyphenate = 'false'">
  301.                 <w:suppressAutoHyphens/>
  302.             </xsl:if>
  303.             <xsl:if test="@style:snap-to-layout-grid='false'">
  304.                 <w:snapToGrid w:val="off"/>
  305.             </xsl:if>
  306.             <xsl:if test="style:tab-stops">
  307.                 <w:tabs>
  308.                     <xsl:for-each select="style:tab-stops/style:tab-stop">
  309.                         <w:tab>
  310.                             <xsl:choose>
  311.                                 <xsl:when test="@style:type='char'">
  312.                                     <xsl:attribute name="w:val">decimal</xsl:attribute>
  313.                                 </xsl:when>
  314.                                 <xsl:when test="@style:type">
  315.                                     <xsl:attribute name="w:val">
  316.                                         <xsl:value-of select="@style:type"/>
  317.                                     </xsl:attribute>
  318.                                 </xsl:when>
  319.                                 <xsl:otherwise>
  320.                                     <xsl:attribute name="w:val">left</xsl:attribute>
  321.                                 </xsl:otherwise>
  322.                             </xsl:choose>
  323.                             <xsl:if test="@style:leader-char">
  324.                                 <xsl:choose>
  325.                                     <xsl:when test="@style:leader-char='-'">
  326.                                         <xsl:attribute name="w:leader">hyphen</xsl:attribute>
  327.                                     </xsl:when>
  328.                                     <xsl:when test="@style:leader-char='_'">
  329.                                         <xsl:attribute name="w:leader">underscore</xsl:attribute>
  330.                                     </xsl:when>
  331.                                     <xsl:when test="@style:leader-char='.'">
  332.                                         <xsl:attribute name="w:leader">dot</xsl:attribute>
  333.                                     </xsl:when>
  334.                                     <xsl:otherwise>
  335.                                         <xsl:attribute name="w:leader">dot</xsl:attribute>
  336.                                     </xsl:otherwise>
  337.                                 </xsl:choose>
  338.                             </xsl:if>
  339.                             <xsl:if test="@style:position">
  340.                                 <xsl:attribute name="w:pos">
  341.                                     <xsl:call-template name="convert2twip">
  342.                                         <xsl:with-param name="value" select="@style:position"/>
  343.                                     </xsl:call-template>
  344.                                 </xsl:attribute>
  345.                             </xsl:if>
  346.                         </w:tab>
  347.                     </xsl:for-each>
  348.                 </w:tabs>
  349.             </xsl:if>
  350.             <xsl:if test="@style:line-break='normal'">
  351.                 <w:kinsoku w:val="off"/>
  352.             </xsl:if>
  353.             <xsl:if test="@style:punctuation-wrap='simple'">
  354.                 <w:overflowPunct w:val="off"/>
  355.             </xsl:if>
  356.             <xsl:if test="@style:text-autospace='none'">
  357.                 <w:autoSpaceDE w:val="off"/>
  358.                 <w:autoSpaceDN w:val="off"/>
  359.             </xsl:if>
  360.             <xsl:if test="@style:vertical-align">
  361.                 <xsl:element name="w:textAlignment">
  362.                     <xsl:choose>
  363.                         <xsl:when test="@style:vertical-align='middle'">
  364.                             <xsl:attribute name="w:val">center</xsl:attribute>
  365.                         </xsl:when>
  366.                         <xsl:otherwise>
  367.                             <xsl:attribute name="w:val">
  368.                                 <xsl:value-of select="@style:vertical-align"/>
  369.                             </xsl:attribute>
  370.                         </xsl:otherwise>
  371.                     </xsl:choose>
  372.                 </xsl:element>
  373.             </xsl:if>
  374.             <xsl:if test="@text:number-lines='false'">
  375.                 <w:supressLineNumbers/>
  376.             </xsl:if>
  377.             <xsl:variable name="border-top" select="@fo:border-top | @fo:border"/>
  378.             <xsl:variable name="border-bottom" select="@fo:border-bottom | @fo:border"/>
  379.             <xsl:variable name="border-left" select="@fo:border-left | @fo:border"/>
  380.             <xsl:variable name="border-right" select="@fo:border-right | @fo:border"/>
  381.             <xsl:variable name="border-line-width-top" select="@style:border-line-width-top | @style:border-line-width "/>
  382.             <xsl:variable name="border-line-width-bottom" select="@style:border-line-width-bottom | @style:border-line-width"/>
  383.             <xsl:variable name="border-line-width-left" select="@style:border-line-width-left | @style:border-line-width"/>
  384.             <xsl:variable name="border-line-width-right" select="@style:border-line-width-right | @style:border-line-width"/>
  385.             <xsl:variable name="padding-top" select="@fo:padding-top | @fo:padding"/>
  386.             <xsl:variable name="padding-bottom" select="@fo:padding-bottom | @fo:padding"/>
  387.             <xsl:variable name="padding-left" select="@fo:padding-left | @fo:padding"/>
  388.             <xsl:variable name="padding-right" select="@fo:padding-right | @fo:padding"/>
  389.             <w:pBdr>
  390.                 <xsl:if test="$border-top">
  391.                     <xsl:element name="w:top">
  392.                         <xsl:call-template name="get-border">
  393.                             <xsl:with-param name="so-border" select="$border-top"/>
  394.                             <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
  395.                             <xsl:with-param name="so-border-position" select=" 'top' "/>
  396.                         </xsl:call-template>
  397.                         <xsl:attribute name="w:space">
  398.                             <xsl:call-template name="convert2pt">
  399.                                 <xsl:with-param name="value" select="$padding-top"/>
  400.                             </xsl:call-template>
  401.                         </xsl:attribute>
  402.                         <xsl:if test="@style:shadow!='none'">
  403.                             <xsl:attribute name="w:shadow">on</xsl:attribute>
  404.                         </xsl:if>
  405.                     </xsl:element>
  406.                 </xsl:if>
  407.                 <xsl:if test="$border-bottom">
  408.                     <xsl:element name="w:bottom">
  409.                         <xsl:call-template name="get-border">
  410.                             <xsl:with-param name="so-border" select="$border-bottom"/>
  411.                             <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
  412.                             <xsl:with-param name="so-border-position" select=" 'bottom' "/>
  413.                         </xsl:call-template>
  414.                         <xsl:attribute name="w:space">
  415.                             <xsl:call-template name="convert2pt">
  416.                                 <xsl:with-param name="value" select="$padding-bottom"/>
  417.                             </xsl:call-template>
  418.                         </xsl:attribute>
  419.                         <xsl:if test="@style:shadow!='none'">
  420.                             <xsl:attribute name="w:shadow">on</xsl:attribute>
  421.                         </xsl:if>
  422.                     </xsl:element>
  423.                 </xsl:if>
  424.                 <xsl:if test="$border-left">
  425.                     <xsl:element name="w:left">
  426.                         <xsl:call-template name="get-border">
  427.                             <xsl:with-param name="so-border" select="$border-left"/>
  428.                             <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
  429.                             <xsl:with-param name="so-border-position" select=" 'left' "/>
  430.                         </xsl:call-template>
  431.                         <xsl:attribute name="w:space">
  432.                             <xsl:call-template name="convert2pt">
  433.                                 <xsl:with-param name="value" select="$padding-left"/>
  434.                             </xsl:call-template>
  435.                         </xsl:attribute>
  436.                         <xsl:if test="@style:shadow!='none'">
  437.                             <xsl:attribute name="w:shadow">on</xsl:attribute>
  438.                         </xsl:if>
  439.                     </xsl:element>
  440.                 </xsl:if>
  441.                 <xsl:if test="$border-right">
  442.                     <xsl:element name="w:right">
  443.                         <xsl:call-template name="get-border">
  444.                             <xsl:with-param name="so-border" select="$border-right"/>
  445.                             <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
  446.                             <xsl:with-param name="so-border-position" select=" 'right' "/>
  447.                         </xsl:call-template>
  448.                         <xsl:attribute name="w:space">
  449.                             <xsl:call-template name="convert2pt">
  450.                                 <xsl:with-param name="value" select="$padding-right"/>
  451.                             </xsl:call-template>
  452.                         </xsl:attribute>
  453.                         <xsl:if test="@style:shadow!='none'">
  454.                             <xsl:attribute name="w:shadow">on</xsl:attribute>
  455.                         </xsl:if>
  456.                     </xsl:element>
  457.                 </xsl:if>
  458.                 <xsl:if test="@style:shadow!='none' and not(@fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right | @fo:border)">
  459.                     <xsl:element name="w:right">
  460.                         <xsl:attribute name="w:shadow">on</xsl:attribute>
  461.                         <xsl:attribute name="w:val">single</xsl:attribute>
  462.                         <xsl:variable name="shadow-size">
  463.                             <xsl:call-template name="convert2cm">
  464.                                 <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/>
  465.                             </xsl:call-template>
  466.                         </xsl:variable>
  467.                         <xsl:attribute name="w:sz">
  468.                             <xsl:choose>
  469.                                 <xsl:when test="$shadow-size <= 0.08">12</xsl:when>
  470.                                 <xsl:when test="$shadow-size <= 0.14">18</xsl:when>
  471.                                 <xsl:when test="$shadow-size <= 0.20">24</xsl:when>
  472.                                 <xsl:when test="$shadow-size <= 0.25">36</xsl:when>
  473.                                 <xsl:otherwise>48</xsl:otherwise>
  474.                             </xsl:choose>
  475.                         </xsl:attribute>
  476.                     </xsl:element>
  477.                     <xsl:element name="w:bottom">
  478.                         <xsl:attribute name="w:shadow">on</xsl:attribute>
  479.                         <xsl:attribute name="w:val">single</xsl:attribute>
  480.                         <xsl:variable name="shadow-size">
  481.                             <xsl:call-template name="convert2cm">
  482.                                 <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/>
  483.                             </xsl:call-template>
  484.                         </xsl:variable>
  485.                         <xsl:attribute name="w:sz">
  486.                             <xsl:choose>
  487.                                 <xsl:when test="$shadow-size <= 0.08">12</xsl:when>
  488.                                 <xsl:when test="$shadow-size <= 0.14">18</xsl:when>
  489.                                 <xsl:when test="$shadow-size <= 0.20">24</xsl:when>
  490.                                 <xsl:when test="$shadow-size <= 0.25">36</xsl:when>
  491.                                 <xsl:otherwise>48</xsl:otherwise>
  492.                             </xsl:choose>
  493.                         </xsl:attribute>
  494.                     </xsl:element>
  495.                 </xsl:if>
  496.             </w:pBdr>
  497.             <w:ind>
  498.                 <xsl:if test="$padding-left!=''">
  499.                     <xsl:attribute name="w:left">
  500.                         <xsl:call-template name="convert2twip">
  501.                             <xsl:with-param name="value" select="$padding-left"/>
  502.                         </xsl:call-template>
  503.                     </xsl:attribute>
  504.                 </xsl:if>
  505.                 <xsl:if test="$padding-right!='' ">
  506.                     <xsl:attribute name="w:right">
  507.                         <xsl:call-template name="convert2twip">
  508.                             <xsl:with-param name="value" select="$padding-right"/>
  509.                         </xsl:call-template>
  510.                     </xsl:attribute>
  511.                 </xsl:if>
  512.             </w:ind>
  513.             <xsl:variable name="stylename">
  514.                 <xsl:value-of select="../@style:name"/>
  515.             </xsl:variable>
  516.             <xsl:if test="/office:document/office:body//text:h[@text:style-name = $stylename]">
  517.                 <xsl:variable name="headinglevel">
  518.                     <xsl:value-of select="/office:document/office:body//text:h[@text:style-name = $stylename]/@text:level"/>
  519.                 </xsl:variable>
  520.                 <xsl:if test="/office:document/office:styles/text:outline-style/text:outline-level-style[@text:level = $headinglevel]">
  521.                     <w:listPr>
  522.                         <w:ilvl w:val="{$headinglevel -1}"/>
  523.                         <w:ilfo w:val="1"/>
  524.                     </w:listPr>
  525.                 </xsl:if>
  526.             </xsl:if>
  527.         </w:pPr>
  528.     </xsl:template>
  529.     <xsl:template match="style:text-properties" mode="character">
  530.         <w:rPr>
  531.             <xsl:if test="@svg:font-family | @style:font-name | @style:font-name-asian | @style:font-name-complex">
  532.                 <w:rFonts>
  533.                     <xsl:variable name="fontname">
  534.                         <xsl:choose>
  535.                             <xsl:when test='starts-with(@svg:font-family,"'")'>
  536.                                 <xsl:value-of select='substring-before(substring-after(@svg:font-family,"'"),"'")'/>
  537.                             </xsl:when>
  538.                             <xsl:when test="@svg:font-family">
  539.                                 <xsl:value-of select="@svg:font-family"/>
  540.                             </xsl:when>
  541.                             <xsl:when test="@style:font-name">
  542.                                 <xsl:value-of select="@style:font-name"/>
  543.                             </xsl:when>
  544.                         </xsl:choose>
  545.                     </xsl:variable>
  546.                     <xsl:if test="string-length($fontname)!=0">
  547.                         <xsl:attribute name="w:ascii">
  548.                             <xsl:value-of select="$fontname"/>
  549.                         </xsl:attribute>
  550.                         <xsl:attribute name="w:h-ansi">
  551.                             <xsl:value-of select="$fontname"/>
  552.                         </xsl:attribute>
  553.                     </xsl:if>
  554.                     <xsl:if test="@style:font-name-asian">
  555.                         <xsl:attribute name="w:fareast">
  556.                             <xsl:value-of select="@style:font-name-asian"/>
  557.                         </xsl:attribute>
  558.                     </xsl:if>
  559.                     <xsl:if test="@style:font-name-complex">
  560.                         <xsl:attribute name="w:cs">
  561.                             <xsl:value-of select="@style:font-name-complex"/>
  562.                         </xsl:attribute>
  563.                     </xsl:if>
  564.                 </w:rFonts>
  565.             </xsl:if>
  566.             <!-- relative font sizes not supported yet. -->
  567.             <xsl:if test="contains(@fo:font-size, 'pt')">
  568.                 <w:sz w:val="{substring-before(@fo:font-size,'pt') * 2}"/>
  569.             </xsl:if>
  570.             <xsl:if test="contains(@fo:font-size-complex, 'pt')">
  571.                 <w:sz-cs w:val="{substring-before(@fo:font-size-complex, 'pt') * 2}"/>
  572.             </xsl:if>
  573.             <xsl:if test="@fo:font-style = 'italic' or @fo:font-style-asian = 'italic'">
  574.                 <w:i/>
  575.             </xsl:if>
  576.             <xsl:if test="@fo:font-style-complex = 'italic'">
  577.                 <w:i-cs/>
  578.             </xsl:if>
  579.             <xsl:if test="@fo:font-weight = 'bold' or @fo:font-weight-asian = 'bold'">
  580.                 <w:b/>
  581.             </xsl:if>
  582.             <xsl:if test="@fo:font-weight-complex = 'bold'">
  583.                 <w:b-cs/>
  584.             </xsl:if>
  585.             <xsl:if test="@style:text-underline-style">
  586.                 <w:u>
  587.                     <xsl:variable name="w-u">
  588.                         <xsl:choose>
  589.                             <xsl:when test="@style:text-underline-style = 'solid'">
  590.                                 <xsl:choose>
  591.                                     <xsl:when test="@style:text-underline-type = 'double'">double</xsl:when>
  592.                                     <xsl:when test="@style:text-underline-width = 'bold'">thick</xsl:when>
  593.                                     <xsl:otherwise>single</xsl:otherwise>
  594.                                 </xsl:choose>
  595.                             </xsl:when>
  596.                             <xsl:when test="@style:text-underline-style = 'dotted'">
  597.                                 <xsl:choose>
  598.                                     <xsl:when test="@style:text-underline-type = 'double'">dotted-double</xsl:when>
  599.                                     <xsl:when test="@style:text-underline-width = 'bold'">dotted-heavy</xsl:when>
  600.                                     <xsl:otherwise>dotted</xsl:otherwise>
  601.                                 </xsl:choose>
  602.                             </xsl:when>
  603.                             <xsl:when test="@style:text-underline-style = 'dash'">
  604.                                 <xsl:choose>
  605.                                     <xsl:when test="@style:text-underline-type = 'double'">dashed-double</xsl:when>
  606.                                     <xsl:when test="@style:text-underline-width = 'bold'">dashed-heavy</xsl:when>
  607.                                     <xsl:otherwise>dash</xsl:otherwise>
  608.                                 </xsl:choose>
  609.                             </xsl:when>
  610.                             <xsl:when test="@style:text-underline-style = 'long-dash'">
  611.                                 <xsl:choose>
  612.                                     <xsl:when test="@style:text-underline-type = 'double'">dash-long-double</xsl:when>
  613.                                     <xsl:when test="@style:text-underline-width = 'bold'">dash-long-heavy</xsl:when>
  614.                                     <xsl:otherwise>dash-long</xsl:otherwise>
  615.                                 </xsl:choose>
  616.                             </xsl:when>
  617.                             <xsl:when test="@style:text-underline-style = 'dot-dash'">
  618.                                 <xsl:choose>
  619.                                     <xsl:when test="@style:text-underline-type = 'double'">dot-dash-double</xsl:when>
  620.                                     <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-heavy</xsl:when>
  621.                                     <xsl:otherwise>dot-dash</xsl:otherwise>
  622.                                 </xsl:choose>
  623.                             </xsl:when>
  624.                             <xsl:when test="@style:text-underline-style = 'dot-dot-dash'">
  625.                                 <xsl:choose>
  626.                                     <xsl:when test="@style:text-underline-type = 'double'">dot-dot-dash-double</xsl:when>
  627.                                     <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-dot-heavy</xsl:when>
  628.                                     <xsl:otherwise>dot-dot-dash</xsl:otherwise>
  629.                                 </xsl:choose>
  630.                             </xsl:when>
  631.                             <xsl:when test="@style:text-underline-style = 'wave'">
  632.                                 <xsl:choose>
  633.                                     <xsl:when test="@style:text-underline-type = 'double'">wavy-double</xsl:when>
  634.                                     <xsl:when test="@style:text-underline-width = 'bold'">wavy-heavy</xsl:when>
  635.                                     <xsl:otherwise>wave</xsl:otherwise>
  636.                                 </xsl:choose>
  637.                             </xsl:when>
  638.                             <xsl:otherwise>
  639.                                 <xsl:value-of select="@style:text-underline-style"/>
  640.                             </xsl:otherwise>
  641.                         </xsl:choose>
  642.                     </xsl:variable>
  643.                     <xsl:attribute name="w:val">
  644.                         <xsl:value-of select="$w-u"/>
  645.                     </xsl:attribute>
  646.                     <xsl:if test="contains(@style:text-underline-color,'#')">
  647.                         <xsl:attribute name="w:color">
  648.                             <xsl:value-of select="substring-after(@style:text-underline-color,'#')"/>
  649.                         </xsl:attribute>
  650.                     </xsl:if>
  651.                 </w:u>
  652.             </xsl:if>
  653.             <xsl:if test="@style:text-shadow | @fo:text-shadow">
  654.                 <w:shadow/>
  655.             </xsl:if>
  656.             <xsl:if test="string-length(@style:text-line-through-style) > 0">
  657.                 <xsl:choose>
  658.                     <xsl:when test="@style:text-line-through-type = 'double'">
  659.                         <w:dstrike/>
  660.                     </xsl:when>
  661.                     <xsl:when test="@style:text-line-through-style = 'solid'">
  662.                         <w:strike/>
  663.                     </xsl:when>
  664.                     <xsl:otherwise>
  665.                         <w:strike/>
  666.                     </xsl:otherwise>
  667.                 </xsl:choose>
  668.             </xsl:if>
  669.             <xsl:if test="@fo:color">
  670.                 <w:color>
  671.                     <xsl:choose>
  672.                         <xsl:when test="@fo:color != '#000000'">
  673.                             <xsl:attribute name="w:val">
  674.                                 <xsl:value-of select="substring-after(@fo:color,'#')"/>
  675.                             </xsl:attribute>
  676.                         </xsl:when>
  677.                         <xsl:otherwise>
  678.                             <xsl:attribute name="w:val">auto</xsl:attribute>
  679.                         </xsl:otherwise>
  680.                     </xsl:choose>
  681.                 </w:color>
  682.             </xsl:if>
  683.             <xsl:if test="@fo:font-variant = 'small-caps'">
  684.                 <w:smallCaps/>
  685.             </xsl:if>
  686.             <xsl:if test="@fo:text-transform = 'uppercase'">
  687.                 <w:caps/>
  688.             </xsl:if>
  689.             <xsl:if test="@style:font-relief = 'engraved'">
  690.                 <w:imprint/>
  691.             </xsl:if>
  692.             <xsl:if test="@style:font-relief = 'embossed'">
  693.                 <w:emboss/>
  694.             </xsl:if>
  695.             <xsl:if test="@style:text-outline = 'true'">
  696.                 <w:outline/>
  697.             </xsl:if>
  698.             <xsl:if test="contains(@style:text-scale,'%')">
  699.                 <w:w w:val="{substring-before(@style:text-scale,'%')}"/>
  700.             </xsl:if>
  701.             <xsl:if test="@style:text-emphasize">
  702.                 <w:em>
  703.                     <xsl:choose>
  704.                         <xsl:when test="contains(@style:text-emphasize, 'accent')">
  705.                             <xsl:attribute name="w:val">comma</xsl:attribute>
  706.                         </xsl:when>
  707.                         <xsl:when test="contains(@style:text-emphasize, 'disc')">
  708.                             <xsl:attribute name="w:val">under-dot</xsl:attribute>
  709.                         </xsl:when>
  710.                         <xsl:when test="contains(@style:text-emphasize, 'none')">
  711.                             <xsl:attribute name="w:val">none</xsl:attribute>
  712.                         </xsl:when>
  713.                         <xsl:when test="contains(@style:text-emphasize, 'dot below')">
  714.                             <xsl:attribute name="w:val">under-dot</xsl:attribute>
  715.                         </xsl:when>
  716.                         <xsl:when test="contains(@style:text-emphasize, 'dot above')">
  717.                             <xsl:attribute name="w:val">dot</xsl:attribute>
  718.                         </xsl:when>
  719.                         <xsl:when test="contains(@style:text-emphasize, 'circle')">
  720.                             <xsl:attribute name="w:val">dot</xsl:attribute>
  721.                         </xsl:when>
  722.                     </xsl:choose>
  723.                 </w:em>
  724.             </xsl:if>
  725.             <xsl:if test="@fo:letter-spacing != 'normal'">
  726.                 <w:spacing>
  727.                     <xsl:attribute name="w:val">
  728.                         <xsl:call-template name="convert2twip">
  729.                             <xsl:with-param name="value" select="@fo:letter-spacing"/>
  730.                         </xsl:call-template>
  731.                     </xsl:attribute>
  732.                 </w:spacing>
  733.             </xsl:if>
  734.             <xsl:if test="@style:text-blinking = 'true'">
  735.                 <w:effect w:val="blink-background"/>
  736.             </xsl:if>
  737.             <xsl:if test="@fo:language | @fo:language-asian | @fo:language-complex">
  738.                 <w:lang>
  739.                     <xsl:if test="@fo:language and @fo:country">
  740.                         <xsl:attribute name="w:val">
  741.                             <xsl:value-of select="concat(@fo:language, '-', @fo:country)"/>
  742.                         </xsl:attribute>
  743.                     </xsl:if>
  744.                     <xsl:if test="@fo:language-asian and @fo:country-asian">
  745.                         <xsl:attribute name="w:fareast">
  746.                             <xsl:value-of select="concat(@fo:language-asian, '-', @fo:country-asian)"/>
  747.                         </xsl:attribute>
  748.                     </xsl:if>
  749.                     <xsl:if test="@fo:language-complex and @fo:language-complex">
  750.                         <xsl:attribute name="w:bidi">
  751.                             <xsl:value-of select="concat(@fo:language-complex, '-', @fo:language-complex)"/>
  752.                         </xsl:attribute>
  753.                     </xsl:if>
  754.                 </w:lang>
  755.             </xsl:if>
  756.             <xsl:if test="@style:text-position">
  757.                 <xsl:variable name="position">
  758.                     <xsl:choose>
  759.                         <xsl:when test="starts-with(@style:text-position, 'super')">superscript_0</xsl:when>
  760.                         <xsl:when test="starts-with(@style:text-position, 'sub')">subscript_0</xsl:when>
  761.                         <xsl:when test="starts-with(@style:text-position, '-')">
  762.                             <xsl:value-of select="concat('subscript_', substring-before(@style:text-position,'%'))"/>
  763.                         </xsl:when>
  764.                         <xsl:otherwise>
  765.                             <xsl:value-of select="concat('superscript_', substring-before(@style:text-position,'%'))"/>
  766.                         </xsl:otherwise>
  767.                     </xsl:choose>
  768.                 </xsl:variable>
  769.                 <w:vertAlign>
  770.                     <xsl:attribute name="w:val">
  771.                         <xsl:value-of select="substring-before($position,'_')"/>
  772.                     </xsl:attribute>
  773.                 </w:vertAlign>
  774.                 <!-- Raised/Lowed position is difficult to map to MSWord w:position, Writer use %, but Word use half-point(not relative position). Since it's difficult to get font-size, use 12pt as default font-size -->
  775.                 <w:position>
  776.                     <xsl:attribute name="w:val">
  777.                         <xsl:choose>
  778.                             <xsl:when test="substring-after($position, '_') = 0">0</xsl:when>
  779.                             <xsl:otherwise>
  780.                                 <xsl:value-of select="round(substring-after($position, '_') div 6)"/>
  781.                             </xsl:otherwise>
  782.                         </xsl:choose>
  783.                     </xsl:attribute>
  784.                 </w:position>
  785.             </xsl:if>
  786.             <xsl:if test="@text:display = 'true'">
  787.                 <w:vanish/>
  788.             </xsl:if>
  789.             <xsl:if test="contains(@fo:background-color, '#')">
  790.                 <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/>
  791.             </xsl:if>
  792.         </w:rPr>
  793.     </xsl:template>
  794.     <xsl:template match="text:p | text:h">
  795.         <w:p>
  796.             <w:pPr>
  797.                 <xsl:if test="@text:style-name">
  798.                     <w:pStyle w:val="{@text:style-name}"/>
  799.                 </xsl:if>
  800.                 <xsl:if test="@text:level">
  801.                     <w:outlineLvl w:val="{@text:level - 1}"/>
  802.                 </xsl:if>
  803.                 <xsl:variable name="following-paragraph-heading-table" select="following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table')]"/>
  804.                 <xsl:variable name="following-section" select="following::text:section[1]"/>
  805.                 <xsl:variable name="ancestor-section" select="ancestor::text:section"/>
  806.                 <!-- if the following neighbour paragraph/heading are slave of one master style, or new section starts,
  807.                  then a new page will start -->
  808.                 <xsl:variable name="next-is-new-page" select="boolean(key( 'slave-style', $following-paragraph-heading-table[1]/@*[name()='text:style-name' or name()='table:style-name']))"/>
  809.                 <xsl:variable name="next-is-new-section">
  810.                     <xsl:if test="$following-section and generate-id($following-section/descendant::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])">
  811.                         <xsl:value-of select="'yes'"/>
  812.                     </xsl:if>
  813.                 </xsl:variable>
  814.                 <xsl:variable name="next-is-section-end">
  815.                     <xsl:if test="$ancestor-section and generate-id($ancestor-section[1]/following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])">
  816.                         <xsl:value-of select="'yes'"/>
  817.                     </xsl:if>
  818.                 </xsl:variable>
  819.                 <xsl:if test="ancestor::office:body and not(ancestor::text:footnote or ancestor::text:endnote) and ($next-is-new-page or $next-is-new-section = 'yes' or $next-is-section-end = 'yes')">
  820.                     <w:sectPr>
  821.                         <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
  822.                             <xsl:with-param name="within-section" select="'yes'"/>
  823.                         </xsl:apply-templates>
  824.                         <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
  825.                             <xsl:with-param name="within-section" select="'yes'"/>
  826.                         </xsl:apply-templates>
  827.                         <xsl:choose>
  828.                             <xsl:when test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])">
  829.                                 <xsl:apply-templates select="key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/>
  830.                                 <xsl:if test="$ancestor-section">
  831.                                     <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
  832.                                         <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/>
  833.                                     </xsl:apply-templates>
  834.                                 </xsl:if>
  835.                                 <xsl:if test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
  836.                                     <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
  837.                                     <xsl:variable name="pagenumber_start">
  838.                                         <xsl:value-of select=" key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
  839.                                     </xsl:variable>
  840.                                     <xsl:if test=" number($pagenumber_start)  > 0 ">
  841.                                         <w:pgNumType w:start="{$pagenumber_start}"/>
  842.                                     </xsl:if>
  843.                                     <!-- comment out the below line to enable the header and footer display normally when style:page-number =0  -->
  844.                                     <!--w:pgNumType w:start="{key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/ -->
  845.                                 </xsl:if>
  846.                             </xsl:when>
  847.                             <xsl:otherwise>
  848.                                 <xsl:variable name="preceding-style" select="preceding::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
  849.                                 <xsl:choose>
  850.                                     <xsl:when test="$preceding-style">
  851.                                         <xsl:apply-templates select="key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/>
  852.                                     </xsl:when>
  853.                                     <xsl:otherwise>
  854.                                         <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
  855.                                     </xsl:otherwise>
  856.                                 </xsl:choose>
  857.                                 <xsl:if test="$ancestor-section">
  858.                                     <xsl:choose>
  859.                                         <xsl:when test="$preceding-style">
  860.                                             <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
  861.                                                 <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/>
  862.                                             </xsl:apply-templates>
  863.                                         </xsl:when>
  864.                                         <xsl:otherwise>
  865.                                             <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
  866.                                                 <xsl:with-param name="master-page" select="/office:document/office:automatic-styles/style:page-layout[1]"/>
  867.                                             </xsl:apply-templates>
  868.                                         </xsl:otherwise>
  869.                                     </xsl:choose>
  870.                                 </xsl:if>
  871.                             </xsl:otherwise>
  872.                         </xsl:choose>
  873.                     </w:sectPr>
  874.                 </xsl:if>
  875.                 <!-- add for office:annotation style G.Y. -->
  876.                 <xsl:if test="name(..)= 'office:annotation' ">
  877.                     <w:pStyle w:val="CommentText"/>
  878.                 </xsl:if>
  879.                 <!-- add by wym for listPr -->
  880.                 <xsl:if test="ancestor::text:ordered-list | ancestor::text:unordered-list | ancestor::text:list">
  881.                     <xsl:variable name="listname">
  882.                         <xsl:value-of select="ancestor::text:ordered-list/@text:style-name | ancestor::text:unordered-list/@text:style-name  | ancestor::text:list/@text:style-name"/>
  883.                     </xsl:variable>
  884.                     <xsl:variable name="currlevel">
  885.                         <xsl:value-of select="count(ancestor::text:list-item|ancestor::text:list-header)"/>
  886.                     </xsl:variable>
  887.                     <xsl:choose>
  888.                         <xsl:when test="string-length($listname)!=0 and $currlevel < 10">
  889.                             <xsl:variable name="currlist">
  890.                                 <xsl:apply-templates select="key('list-style', $listname)" mode="count"/>
  891.                             </xsl:variable>
  892.                             <w:listPr>
  893.                                 <w:ilvl w:val="{number($currlevel)-1}"/>
  894.                                 <w:ilfo w:val="{$currlist}"/>
  895.                             </w:listPr>
  896.                         </xsl:when>
  897.                         <xsl:when test="string-length($listname)!=0">
  898.                             <xsl:for-each select="key('list-style', $listname)">
  899.                                 <xsl:variable name="spacebefore">
  900.                                     <xsl:choose>
  901.                                         <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before">
  902.                                             <xsl:call-template name="convert2twip">
  903.                                                 <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"/>
  904.                                             </xsl:call-template>
  905.                                         </xsl:when>
  906.                                         <xsl:otherwise>0</xsl:otherwise>
  907.                                     </xsl:choose>
  908.                                 </xsl:variable>
  909.                                 <xsl:variable name="space2text">
  910.                                     <xsl:choose>
  911.                                         <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width">
  912.                                             <xsl:call-template name="convert2twip">
  913.                                                 <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"/>
  914.                                             </xsl:call-template>
  915.                                         </xsl:when>
  916.                                         <xsl:otherwise>0</xsl:otherwise>
  917.                                     </xsl:choose>
  918.                                 </xsl:variable>
  919.                                 <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
  920.                             </xsl:for-each>
  921.                         </xsl:when>
  922.                         <xsl:otherwise>
  923.                             <w:listPr>
  924.                                 <w:ilvl w:val="{number($currlevel)-1}"/>
  925.                                 <w:ilfo w:val="1"/>
  926.                             </w:listPr>
  927.                         </xsl:otherwise>
  928.                     </xsl:choose>
  929.                 </xsl:if>
  930.                 <!-- end of listPr -->
  931.             </w:pPr>
  932.             <!-- get break column from style -->
  933.             <xsl:variable name="style" select="key('paragraph-style', @text:style-name)/style:paragraph-properties"/>
  934.             <xsl:if test="$style/@fo:break-before = 'column'">
  935.                 <w:r>
  936.                     <w:br w:type="column"/>
  937.                 </w:r>
  938.             </xsl:if>
  939.             <xsl:if test="parent::office:text and not(preceding-sibling::text:p)">
  940.                 <xsl:call-template name="PageLevelGraphic"/>
  941.             </xsl:if>
  942.             <xsl:if test="parent::text:footnote-body and not(preceding-sibling::*)">
  943.                 <w:r>
  944.                     <w:rPr>
  945.                         <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-style-name}"/>
  946.                     </w:rPr>
  947.                     <xsl:choose>
  948.                         <xsl:when test="../../text:footnote-citation/@text:label">
  949.                             <w:t>
  950.                                 <xsl:value-of select="../../text:footnote-citation/@text:label"/>
  951.                             </w:t>
  952.                         </xsl:when>
  953.                         <xsl:otherwise>
  954.                             <w:footnoteRef/>
  955.                         </xsl:otherwise>
  956.                     </xsl:choose>
  957.                 </w:r>
  958.                 <w:r>
  959.                     <w:tab/>
  960.                 </w:r>
  961.             </xsl:if>
  962.             <xsl:if test="parent::text:endnote-body and not(preceding-sibling::*)">
  963.                 <w:r>
  964.                     <w:rPr>
  965.                         <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-style-name}"/>
  966.                     </w:rPr>
  967.                     <xsl:choose>
  968.                         <xsl:when test="../../text:endnote-citation/@text:label">
  969.                             <w:t>
  970.                                 <xsl:value-of select="../../text:endnote-citation/@text:label"/>
  971.                             </w:t>
  972.                         </xsl:when>
  973.                         <xsl:otherwise>
  974.                             <w:endnoteRef/>
  975.                         </xsl:otherwise>
  976.                     </xsl:choose>
  977.                 </w:r>
  978.                 <w:r>
  979.                     <w:tab/>
  980.                 </w:r>
  981.             </xsl:if>
  982.             <!-- newly added the endnote , footnote templates -->
  983.             <xsl:if test="../../@text:note-class='endnote'  and not(preceding-sibling::*)">
  984.                 <xsl:message>
  985.                     <xsl:value-of select=" 'enter into ext:note-class= endnote' "/>
  986.                 </xsl:message>
  987.                 <w:r>
  988.                     <w:rPr>
  989.                         <w:rStyle w:val="Endnote_20_Symbol"/>
  990.                     </w:rPr>
  991.                     <xsl:choose>
  992.                         <xsl:when test="../../text:note-citation/@text:label">
  993.                             <w:t>
  994.                                 <xsl:value-of select="../../text:note-citation/@text:label"/>
  995.                             </w:t>
  996.                         </xsl:when>
  997.                         <xsl:otherwise>
  998.                             <w:footnoteRef/>
  999.                         </xsl:otherwise>
  1000.                     </xsl:choose>
  1001.                 </w:r>
  1002.                 <w:r>
  1003.                     <w:tab/>
  1004.                 </w:r>
  1005.             </xsl:if>
  1006.             <xsl:if test="../../@text:note-class='footnote'  and not(preceding-sibling::*)">
  1007.                 <xsl:message>
  1008.                     <xsl:value-of select=" 'enter into ext:note-class= footnote' "/>
  1009.                 </xsl:message>
  1010.                 <w:r>
  1011.                     <w:rPr>
  1012.                         <w:rStyle w:val="Footnote_20_Symbol"/>
  1013.                     </w:rPr>
  1014.                     <xsl:choose>
  1015.                         <xsl:when test="../../text:note-citation/@text:label">
  1016.                             <w:t>
  1017.                                 <xsl:value-of select="../../text:note-citation/@text:label"/>
  1018.                             </w:t>
  1019.                         </xsl:when>
  1020.                         <xsl:otherwise>
  1021.                             <w:footnoteRef/>
  1022.                         </xsl:otherwise>
  1023.                     </xsl:choose>
  1024.                 </w:r>
  1025.                 <w:r>
  1026.                     <w:tab/>
  1027.                 </w:r>
  1028.             </xsl:if>
  1029.             <!-- apply inline-text-elements, many many many ... :( glu -->
  1030.             <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop
  1031.              | text:s | text:note  | draw:*
  1032.              | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
  1033.              | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
  1034.              | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
  1035.              | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
  1036.              | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
  1037.              | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
  1038.              | text:table-count | text:image-count | text:object-count | text:template-name | text:description
  1039.              | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
  1040.              | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
  1041.              | text:user-defined | text:printed-by | text:hidden-paragraph  | text:placeholder | text:drop-down
  1042.              | text:conditional-text  | text:text-input | text:execute-macro | text:variable-set | text:variable-input
  1043.              | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
  1044.              | text:page-variable-get | text:table-formula | text:database-display | text:database-next
  1045.              | text:database-select | text:database-row-number | text:database-name | text:reference-ref
  1046.              | text:bookmark-ref | text:footnote-ref  | text:endnote-ref | text:sequence-ref | text:expression
  1047.              | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
  1048.              | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
  1049.  "/>
  1050.             <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format -->
  1051.             <!--xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop
  1052.              | text:s | text:footnote | text:endnote | draw:*
  1053.              | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
  1054.              | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
  1055.              | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
  1056.              | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
  1057.              | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
  1058.              | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
  1059.              | text:table-count | text:image-count | text:object-count | text:template-name | text:description
  1060.              | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
  1061.              | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
  1062.              | text:user-defined | text:printed-by | text:hidden-paragraph  | text:placeholder | text:drop-down
  1063.              | text:conditional-text  | text:text-input | text:execute-macro | text:variable-set | text:variable-input
  1064.              | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
  1065.              | text:page-variable-get | text:table-formula | text:database-display | text:database-next
  1066.              | text:database-select | text:database-row-number | text:database-name | text:reference-ref
  1067.              | text:bookmark-ref | text:footnote-ref  | text:endnote-ref | text:sequence-ref | text:expression
  1068.              | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
  1069.              | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
  1070.  "/-->
  1071.             <xsl:if test="$style/@fo:break-after">
  1072.                 <w:r>
  1073.                     <w:br w:type="{$style/@fo:break-after}"/>
  1074.                 </w:r>
  1075.             </xsl:if>
  1076.         </w:p>
  1077.     </xsl:template>
  1078.     <xsl:template match="text:span">
  1079.         <!-- apply inline-text-elements, many many many ... :( glu -->
  1080.         <xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s
  1081.              | text:note
  1082.              | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
  1083.              | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
  1084.              | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
  1085.              | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
  1086.              | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
  1087.              | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
  1088.              | text:table-count | text:image-count | text:object-count | text:template-name | text:description
  1089.              | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
  1090.              | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
  1091.              | text:user-defined | text:printed-by | text:hidden-paragraph  | text:placeholder | text:drop-down
  1092.              | text:conditional-text  | text:text-input | text:execute-macro | text:variable-set | text:variable-input
  1093.              | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
  1094.              | text:page-variable-get | text:table-formula | text:database-display | text:database-next
  1095.              | text:database-select | text:database-row-number | text:database-name | text:reference-ref
  1096.              | text:bookmark-ref | text:footnote-ref  | text:endnote-ref | text:sequence-ref | text:expression
  1097.              | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
  1098.              | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
  1099. "/>
  1100.         <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format -->
  1101.         <!-- xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s
  1102.              | text:footnote | text:endnote
  1103.              | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
  1104.              | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
  1105.              | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
  1106.              | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
  1107.              | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
  1108.              | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
  1109.              | text:table-count | text:image-count | text:object-count | text:template-name | text:description
  1110.              | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
  1111.              | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
  1112.              | text:user-defined | text:printed-by | text:hidden-paragraph  | text:placeholder | text:drop-down
  1113.              | text:conditional-text  | text:text-input | text:execute-macro | text:variable-set | text:variable-input
  1114.              | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
  1115.              | text:page-variable-get | text:table-formula | text:database-display | text:database-next
  1116.              | text:database-select | text:database-row-number | text:database-name | text:reference-ref
  1117.              | text:bookmark-ref | text:footnote-ref  | text:endnote-ref | text:sequence-ref | text:expression
  1118.              | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
  1119.              | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
  1120. "/-->
  1121.     </xsl:template>
  1122.     <xsl:template match="text()">
  1123.         <xsl:if test="string-length(normalize-space(.)) > 0">
  1124.             <w:r>
  1125.                 <xsl:if test="parent::text:span">
  1126.                     <w:rPr>
  1127.                         <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
  1128.                     </w:rPr>
  1129.                 </xsl:if>
  1130.                 <w:t>
  1131.                     <xsl:value-of select="."/>
  1132.                 </w:t>
  1133.             </w:r>
  1134.         </xsl:if>
  1135.     </xsl:template>
  1136.     <xsl:template match="text:hidden-text">
  1137.         <w:r>
  1138.             <w:rPr>
  1139.                 <xsl:if test="parent::text:span">
  1140.                     <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
  1141.                 </xsl:if>
  1142.                 <w:vanish/>
  1143.             </w:rPr>
  1144.             <w:t>
  1145.                 <xsl:value-of select="@text:string-value"/>
  1146.             </w:t>
  1147.         </w:r>
  1148.     </xsl:template>
  1149.     <xsl:template match="text:line-break">
  1150.         <w:r>
  1151.             <xsl:if test="parent::text:span">
  1152.                 <w:rPr>
  1153.                     <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
  1154.                 </w:rPr>
  1155.             </xsl:if>
  1156.             <w:br w:type="text-wrapping" w:clear="all"/>
  1157.         </w:r>
  1158.     </xsl:template>
  1159.     <xsl:template match="text:tab-stop">
  1160.         <w:r>
  1161.             <xsl:if test="parent::text:span">
  1162.                 <w:rPr>
  1163.                     <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
  1164.                 </w:rPr>
  1165.             </xsl:if>
  1166.             <w:tab/>
  1167.         </w:r>
  1168.     </xsl:template>
  1169.     <xsl:template match="text:s">
  1170.         <w:r>
  1171.             <xsl:if test="parent::text:span">
  1172.                 <w:rPr>
  1173.                     <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
  1174.                 </w:rPr>
  1175.             </xsl:if>
  1176.             <w:t>
  1177.                 <xsl:if test="@text:c">
  1178.                     <xsl:call-template name="add-space">
  1179.                         <xsl:with-param name="number" select="@text:c"/>
  1180.                     </xsl:call-template>
  1181.                 </xsl:if>
  1182.                 <xsl:text> </xsl:text>
  1183.             </w:t>
  1184.         </w:r>
  1185.     </xsl:template>
  1186.     <xsl:template name="add-space">
  1187.         <xsl:param name="number"/>
  1188.         <xsl:if test="$number > 1">
  1189.             <xsl:call-template name="add-space">
  1190.                 <xsl:with-param name="number" select="$number - 1"/>
  1191.             </xsl:call-template>
  1192.             <xsl:text> </xsl:text>
  1193.         </xsl:if>
  1194.     </xsl:template>
  1195.     <xsl:template match="text:footnote">
  1196.         <w:r>
  1197.             <w:rPr>
  1198.                 <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-body-style-name}"/>
  1199.             </w:rPr>
  1200.             <xsl:apply-templates select="text:footnote-body"/>
  1201.         </w:r>
  1202.     </xsl:template>
  1203.     <xsl:template match="text:footnote-body">
  1204.         <w:footnote>
  1205.             <xsl:if test="../text:footnote-citation/@text:label">
  1206.                 <xsl:attribute name="w:suppressRef">on</xsl:attribute>
  1207.             </xsl:if>
  1208.             <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
  1209.         </w:footnote>
  1210.     </xsl:template>
  1211.     <xsl:template match="text:endnote">
  1212.         <w:r>
  1213.             <w:rPr>
  1214.                 <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-body-style-name}"/>
  1215.             </w:rPr>
  1216.             <xsl:apply-templates select="text:endnote-body"/>
  1217.         </w:r>
  1218.     </xsl:template>
  1219.     <xsl:template match="text:endnote-body">
  1220.         <w:endnote>
  1221.             <xsl:if test="../text:endnote-citation/@text:label">
  1222.                 <xsl:attribute name="w:suppressRef">on</xsl:attribute>
  1223.             </xsl:if>
  1224.             <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
  1225.         </w:endnote>
  1226.     </xsl:template>
  1227.     <xsl:template match="text:bookmark-start">
  1228.         <xsl:variable name="bookmark-id">
  1229.             <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
  1230.         </xsl:variable>
  1231.         <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/>
  1232.     </xsl:template>
  1233.     <xsl:template match="text:bookmark-end">
  1234.         <xsl:variable name="bookmark-id">
  1235.             <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
  1236.         </xsl:variable>
  1237.         <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/>
  1238.     </xsl:template>
  1239.     <xsl:template match="text:bookmark">
  1240.         <xsl:variable name="bookmark-id">
  1241.             <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
  1242.         </xsl:variable>
  1243.         <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/>
  1244.         <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/>
  1245.     </xsl:template>
  1246.     <!-- newly added the endnote , footnote templates -->
  1247.     <xsl:template match="text:note">
  1248.         <xsl:choose>
  1249.             <xsl:when test="@text:note-class = 'endnote' ">
  1250.                 <w:r>
  1251.                     <w:rPr>
  1252.                         <w:rStyle w:val="Endnote"/>
  1253.                     </w:rPr>
  1254.                     <xsl:apply-templates select="text:note-body"/>
  1255.                 </w:r>
  1256.             </xsl:when>
  1257.             <xsl:when test="@text:note-class = 'footnote' ">
  1258.                 <w:r>
  1259.                     <w:rPr>
  1260.                         <w:rStyle w:val="Footnote"/>
  1261.                     </w:rPr>
  1262.                     <xsl:apply-templates select="text:note-body"/>
  1263.                 </w:r>
  1264.             </xsl:when>
  1265.         </xsl:choose>
  1266.     </xsl:template>
  1267.     <xsl:template match="text:note-body">
  1268.         <xsl:choose>
  1269.             <xsl:when test="../@text:note-class='endnote' ">
  1270.                 <w:endnote>
  1271.                     <xsl:if test="../text:note-citation/@text:label">
  1272.                         <xsl:attribute name="w:suppressRef">on</xsl:attribute>
  1273.                     </xsl:if>
  1274.                     <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
  1275.                 </w:endnote>
  1276.             </xsl:when>
  1277.             <xsl:when test="../@text:note-class='footnote' ">
  1278.                 <w:footnote>
  1279.                     <xsl:if test="../text:note-citation/@text:label">
  1280.                         <xsl:attribute name="w:suppressRef">on</xsl:attribute>
  1281.                     </xsl:if>
  1282.                     <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
  1283.                 </w:footnote>
  1284.             </xsl:when>
  1285.         </xsl:choose>
  1286.     </xsl:template>
  1287. </xsl:stylesheet>
  1288.